//
//  UIImageView+NetworkImage.m
//  WoComCloud
//
//  Created by WC on 2020/5/10.
//  Copyright © 2021年 YH. All rights reserved.
//

#import "UIImageView+NetworkImage.h"

@implementation UIImageView (NetworkImage)


- (void)setImageWithUrl:(NSString *)url placeholderImg:(NSString *)placeholderImg
{
    [self sd_setImageWithURL:[NSURL URLWithString:url] placeholderImage:[UIImage imageNamed:placeholderImg]];
}

- (void)setImageWithUrl:(NSString *)url placeholderImg:(NSString *)placeholderImg isCircle:(BOOL)isCircle
{
    if (isCircle) {
        [self sd_setImageWithURL:[NSURL URLWithString:url] placeholderImage:[[UIImage imageNamed:placeholderImg] getCircleImage] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
            UIImage *resultImage = [image getCircleImage];
            if (resultImage == nil) return;
            self.image = resultImage;
        }];
    }else {
        [self sd_setImageWithURL:[NSURL URLWithString:url]  placeholderImage:[UIImage imageNamed:placeholderImg] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
            if (image == nil) return;
            self.image = image;
        }];
    }
}


@end

